import pytest
import ALLRequest
import yaml_util


class Test:

    ## @pytest.mark.parametrize("caseinfo", ["AAA", "BBB", "CCC"])
    def test_login1(self): #错误的登录
        url = "http://47.94.167.63:8080/blog_system/login"
        data = {'username': 'lisi',
                'password': 1234
                }
        resp = ALLRequest.all_request(method='POST', url=url, data=data, json=True)
        resp.encoding = 'utf-8'
        print(resp.text)

    ## @pytest.mark.parametrize("id,password", ["lisi", "123"])
    def test_login2(self):
        url = "http://47.94.167.63:8080/blog_system/login"
        data = {'username': 'lisi',
                'password': 123
                }
        resp = ALLRequest.all_request(method='POST', url=url, data=data, json=True)
        print("登录成功：")
        print(resp.status_code)

    def test_blog03(self):
        url = "http://47.94.167.63:8080/blog_system/blog?blogId=3"
        data = {
            "headers": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.0.0",
            "referer": "http://47.94.167.63:8080/blog_system/blog_detail.html?blogId=3"
        }
        resp = ALLRequest.all_request(method='GET', url=url, data=data)
        resp.encoding = 'utf-8'
        print(resp.status_code)

    def test_blog02(self):
        url = "http://47.94.167.63:8080/blog_system/blog?blogId=2"
        data = {
            "headers": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.0.0",
            "referer": "http://47.94.167.63:8080/blog_system/blog_detail.html?blogId=2"
        }
        resp = ALLRequest.all_request(method='GET', url=url, data=data)
        resp.encoding = 'utf-8'
        print(resp.status_code)

    def test_blog01(self):
        url = "http://47.94.167.63:8080/blog_system/blog?blogId=1"
        data = {
            "headers": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.0.0",
            "referer": "http://47.94.167.63:8080/blog_system/blog_detail.html?blogId=1"
        }
        resp = ALLRequest.all_request(method='GET', url=url, data=data)
        resp.encoding = 'utf-8'
        print(resp.status_code)



